package com.code.common.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: Yan
 * @date: 2023/4/19
 */
@Configuration
public class CommonConfig {

    @Bean
    @ConditionalOnMissingBean
    public Snowflake snowflake() {
        return new Snowflake(new Date(), Thread.currentThread().getId(), 1L, true);
    }
}
